package com.pphh.demo.service;

import com.pphh.demo.dao.UserInfoDAO;
import com.pphh.demo.model.UserInfoDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserBService {

    @Autowired
    UserInfoDAO userInfoDAO;

    @Transactional(value = "txManager")
    //@Transactional(propagation = Propagation.REQUIRES_NEW)
    //@Transactional(propagation = Propagation.NOT_SUPPORTED)
    public void insertUser(UserInfoDTO user) throws Exception {
        user.setUserName("service-b");
        userInfoDAO.insert(user);
        throw new RuntimeException("函数执行有异常!");
    }

}
